<template>
  <div id="app">
    <!-- <img src="./assets/logo.png"> -->
      <mt-header fixed title="首页">
        <router-link to="/" slot="left">
        <mt-button icon="back">返回</mt-button>
        </router-link>
        <mt-button icon="more" slot="right"></mt-button>
      </mt-header>
    <transition>
      <router-view></router-view>
    </transition>
    <!-- ***************************** -->
    <mt-tabbar  v-model="selected" fixed>
      <mt-tab-item id="home">
          <img slot="icon" src="./assets/zhuye.png">
          首页
        </mt-tab-item>
        <mt-tab-item id="vip">
          <img slot="icon" src="./assets/vip.png">
          VIP
        </mt-tab-item>

        <mt-tab-item id="shopcar">
          <img slot="icon" src="./assets/shopcar.png">
          购物车
          <span class="mui-badge" id="spanShopCar">0</span>
        </mt-tab-item>

        <mt-tab-item id="sousuo">
          <img slot="icon" src="./assets/find.png">
          搜索
        </mt-tab-item>
        
    </mt-tabbar>

  </div>
</template>

<script>
export default {
  name: 'App',
  data(){
    return{
      selected:""
    }
  },
  watch:{
    selected:function(newval,oldval){
      console.log(newval,oldval)
      this.$router.push({
        name:this.selected
      })
    }
  }
}
</script>

<style>
    *{
      margin:0px;
      padding:0px;
    }
    .v-enter{
      opacity: 0;
      transform: translateX(100%);
    }
    .v-leave-to{
      opacity: 0;
      transform: translateX(-100%);
      position: absolute;
    }
    .v-enter-active,  
    .v-leave-active{
      transition: all 0.4s ease;
    }
    .mui-badge {
    font-size: 12px;
    line-height: 1;
    display: inline-block;
    padding: 3px 6px;
    color: white;
    border-radius: 100px;
    background-color: red;
  }
    
</style>
